<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue.js"></script>
</head>
<body>
<div id="root">
    <p>{{num}}</p>
    <child></child>
</div>
</body>
<script>
    new Vue({
        el : '#root',
        data :{
            num : 1
        },
        beforeCreate(){
            console.log('外-beforeCreat')
        },
        created(){
            console.log('外-created')
        },
        beforeMount(){
            console.log('外-beforeMount')
        },
        mounted(){
            console.log('外-mounted')
        },
        components:{
            Child:{
                template:(`
                    <button>child</button>
                `),
                beforeCreate(){
                    console.log('--------');
                    console.log(this.$data);
                    console.log(this.$el);
                    console.log('子-beforeCreat');
                },
                created(){
                    console.log('--------');
                    console.log(this.$data);
                    console.log(this.$el);
                    console.log('子-created')
                },
                beforeMount(){
                    console.log('--------');
                    console.log(this.$data);
                    console.log(this.$el);
                    console.log('子-beforeMount')
                },
                mounted(){
                    console.log('--------');
                    console.log(this.$data);
                    console.log(this.$el);
                    console.log('子-mounted')
                },
            }
        }
    })
</script>
</html>